//
//  YUYAHotAreaCell.m
//  com.yigu.yuya
//
//  Created by hxp on 16/3/9.
//  Copyright © 2016年 hxp. All rights reserved.
//

#import "YAYIHotAreaListCell.h"

@implementation YAYIHotAreaListCell

- (void)awakeFromNib {
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // 改变背景色和状态
    self.selectBtn.hidden = !selected;
    
    if (selected) {
        self.local.transform = CGAffineTransformMakeTranslation(12, 0);
    }else{
        self.local.transform = CGAffineTransformMakeTranslation(0, 0);
    }
    
  
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createViews];
    }
    return  self;
}

-(void)createViews{
    self.selectedBackgroundView = [[UIView alloc] init];
    self.selectedBackgroundView.backgroundColor = [UIColor whiteColor];
    
    self.local = [UILabel new];
    self.local.textColor  = [UIColor colorWithRed:87/255.0 green:85/255.0 blue:85/255.0 alpha:1];
    self.local.font = [UIFont systemFontOfSize:14];
    
    [self.contentView addSubview:self.local];
    
    self.selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView  addSubview:self.selectBtn];
    self.seprateLine = [UILabel new];
    
    
    self.seprateLine.backgroundColor = YAYIColor(222, 222, 222);
    [self.contentView addSubview:self.seprateLine];
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    [self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
//        make.size.mas_equalTo(CGSizeMake(10/2.0, 27/3.0));
        make.size.mas_equalTo(CGSizeMake(5, 10));
    }];
    [self.local mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.mas_equalTo(self.selectBtn.mas_left).with.offset(0);
        make.right.equalTo(@10);
        make.height.equalTo(@20);
    }];
    [self.seprateLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.bottom.mas_equalTo(self.contentView.mas_bottom);
        make.size.mas_equalTo(CGSizeMake(SCREEN_width, 1));
    }];
}
@end
